import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import Layout from '@/layout'

export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: '首页', icon: 'dashboard' }
    }]
  },
  {
    path: '/regist',
    component: () => import('@/views/regist/index'),
    hidden: true
  },

 
  {
    path: '/sstem',
    component: Layout,
    redirect: '/system',
    name: 'System',
    
    children: [
      {
        path: 'emp',
        name: 'Emp',
        component: () => import('@/views/emp'),
        meta: { title: '用户管理', icon: 'el-icon-user-solid' }
      //}
      },
  //     {
  //       path: 'dept',
  //       name: 'Dept',
  //       component: () => import('@/views/dept'),
  //       meta: { title: '部门管理', icon: 'el-icon-s-cooperation' }
  //     },
 
  //     {
  //       path: 'job',
  //       name: 'Job',
  //       component: () => import('@/views/job'),
  //       meta: { title: '职位管理', icon: 'el-icon-s-platform' }
  //     },
  //     {
  //       path: 'user',
  //       name: 'User',
  //       component: () => import('@/views/user'),
  //       meta: { title: '登录管理', icon: 'el-icon-switch-button' }
  //     }
    ]
  },

 
  {
    path: '/report',
    component: Layout,
    redirect: '/report',
    name: 'Report',

    children: [
      {
        path: 'emp-report',
        name: 'emp-report',
        component: () => import('@/views/dept'),
        meta: { title: '奖学金类别管理', icon: 'el-icon-s-data' }
      },
      // {
      //   path: 'student-report',
      //   name: 'student-report',
      //   component: () => import('@/views/student-report'),
      //   meta: { title: '职位变动管理', icon: 'el-icon-s-data' }
      // }
    ]
  },
  {
    path: '/retport',
    component: Layout,
    redirect: '/retport',
    name: 'Repotrt',
    
    children: [
      {
        path: 'emp-report',
        name: 'emp-report',
        component: () => import('@/views/job'),
        meta: { title: '奖学金申请管理', icon: 'el-icon-s-data' }
      },
      // {
      //   path: 'student-report',
      //   name: 'student-report',
      //   component: () => import('@/views/student-report'),
      //   meta: { title: '职位变动管理', icon: 'el-icon-s-data' }
      // }
    ]
  },
   {
    path: '/example',
    component: Layout,
    redirect: '/example',
    name: 'Example',
  
    children: [
      {
        path: 'student-report',
        name: 'lasses',
        component: () => import('@/views/student-report'),
        meta: { title: '奖学金打分记录', icon: 'el-icon-folder-add' }
      },
      // {
      //   path: 'student',
      //   name: 'Student',
      //   component: () => import('@/views/student'),
      //   meta: { title: '离职记录', icon: 'el-icon-folder-remove' }
      // }
    ]
  }, 
 
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()


export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
